package lhb.spark.sparkstreaming



import org.apache.log4j.{Level, Logger}
import org.apache.spark.SparkConf
import org.apache.spark.streaming.dstream.ReceiverInputDStream
import org.apache.spark.streaming.{Minutes, StreamingContext}

class streamTest {

  def main(args: Array[String]): Unit = {

    //日志打印级别
    Logger.getLogger("org").setLevel(Level.ERROR)
    //streaming创建
    val conf = new SparkConf()
      .setAppName(this.getClass.getSimpleName)
      .setMaster("local[*]")
    val ssc = new StreamingContext(conf, Minutes(2))

    //端口号，端口 通过socket方式读
    val inputvalue: ReceiverInputDStream[String] = ssc.socketTextStream("worker1", 9999)

    //actionRdd

    //ssc.stop()
    //streaming 7*24不挂
    ssc.start()
    ssc.awaitTermination()
  }

}
